/**
 * @author 陈泰来
 * @version V1.0
 * @Project echo-java-base
 * @Title 鹅鸭适配器
 * @Description *
 * @Package designmodel.composite.adaptor
 * @date 2021/3/2 4:31 下午
 * @Copyright:学如逆水行舟，不进则退 .
 */
package designmodel.composite.adaptor;

import designmodel.composite.Goose;
import designmodel.composite.Quackable;
import designmodel.composite.observer.Observable;
import designmodel.composite.observer.Observer;

public class GooseAdapter implements Quackable {

    Observable observable;

    Goose goose;

    //构造
    public GooseAdapter(Goose goose) {
        this.goose = goose;
        observable = new Observable(this);
    }

    @Override
    public void quack() {
        goose.honk();
    }

    @Override
    public void registerObserver(Observer observer) {
        observable.registerObserver(observer);
    }

    @Override
    public void notifyObservers() {
        observable.notifyObservers();
    }
}
